/************提交数据**********/
$('.surelogin').on('click',function(){
    var check=true
    mui(".form-login input").each(function() {
        if(!this.value || this.value.trim() == "") {
            var label = this.previousElementSibling;
            mui.alert(label.innerText + "不允许为空");
            check = false;
            return false;
        }
    }); //校验通过，继续执行业务逻辑 
    if(check){
        sendFormData=getformData('.form-login')
        var upLoginData={
            url:'user/login',
            fromwho:'ch',
            sendData:sendFormData
        }
        getAjax(upLoginData,
            function(data){
                if(data.result==1){
                    mui.toast(data.msg)
                    var permissionInfo=JSON.stringify(data.data.auth)
                    var userInfo=JSON.stringify(data.data.user)
                    localStorage.setItem('permissionInfo',permissionInfo)
                    localStorage.setItem('userInfo',userInfo)
                    localStorage.setItem('sid',data.sessionid)
                    var backurl=GetQueryString('backurl')
                    if(backurl){
                        window.location.replace(backurl);
                    }else{
                        alert(1)
                        window.location.href='index.html';
                    }
                }else{
                    mui.toast(data.msg)
                }
                
            },
            function(data){
                
            }
        )
    }
})

/************提交数据end**********/
/************返回**********/
$('.backlogin').on('click',function(){
    window.location.replace('index.html')
})
/************返回end**********/
/************注册**********/
$('#reg').on('click',function(){
    window.location.href='reg.html'
})
/************注册end**********/
